package com.fanqiechaodan.strategy;

/**
 * @author fanqiechaodan
 * @Classname Demo
 * @Description 策略模式
 */
public class Demo {

    public static void main(String[] args) {
        ShoppingCart shoppingCart = new ShoppingCart();

        Item item1 = new Item("item1",10);
        Item item2 = new Item("item2",10);
        shoppingCart.addItem(item1);
        shoppingCart.addItem(item2);

        shoppingCart.setPaymentStrategy(new AliPayment("aliPayUsername","aliPayPassword"));
        shoppingCart.pay();

        shoppingCart.setPaymentStrategy(new WechatPayment("wechatUsername","wechatPassword"));
        shoppingCart.pay();
    }
}
